// Author	: damphat@gmail.com
// Created	: 01/12/2008

#pragma once
#include "vn/String.hpp"
#include "vn/Convert.h"


class StringBuilder {
public:
	StringBuilder(int capacity = 0) {
	}

	virtual ~StringBuilder() {}

	template<class T>
	StringBuilder& Append(T v) {
		m_str += Convert::ToString(v);
		return *this;
	}

	template<class T>
	StringBuilder& Append(T v, int radixOrDitgits) {
		m_str += Convert::ToString(v, radixOrDitgits);
		return *this;
	}

	template<class T>
	StringBuilder& AppendLine(T v) {
		m_str += Convert::ToString(v);
		AppendLine();
		return *this;
	}

	template<class T>
	StringBuilder& AppendLine(T v, int radixOrDitgits) {
		m_str += Convert::ToString(v, radixOrDitgits);
		AppendLine();
		return *this;
	}

	StringBuilder& AppendLine() {
		m_str += "\r\n";
		return *this;
	}

	template<class T>
	StringBuilder& operator << (T v) {
		m_str += Convert::ToString(v);
		return *this;
	}

	String ToString() const {
		return m_str;
	}

private:
	String m_str;

};

// TODO:
// 1. Capacity (in chars)
// 2. GetBuffer, GetBufferLength	(in bytes)
//
